package com.ywu.container.standard.api;

import com.ywu.common.result.CommonResult;
import com.ywu.container.standard.dto.FrpcManageDto;
import com.ywu.container.standard.service.FrpcManageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName FrpcManageApi
 * @Description TODO
 * @Author GroundDemo
 * @Date 2024/7/13 15:42
 * @Version 1.0
 **/
@RestController
@RequestMapping("/ywu/container/frpc")
public class FrpcManageApi {
    @Autowired
    private FrpcManageService service;

    /**
    * @Author GroundDemo
    * @Description 创建frpc客户端端口映射
    * @Date 16:13 2024/7/13
    * @Param [manageDto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/frpc.manage.create.info")
    public CommonResult<Object> createFrpcInfo(@RequestBody FrpcManageDto manageDto) {
        return service.createFrpcInfo(manageDto);
    }

    /**
    * @Author GroundDemo
    * @Description 删除端口映射
    * @Date 16:38 2024/7/13
    * @Param [manageDto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/frpc.manage.delete.info")
    public CommonResult<Object> deleteFrpcInfo(@RequestBody FrpcManageDto manageDto) {
        return service.deleteFrpcInfo(manageDto);
    }

    /**
    * @Author GroundDemo
    * @Description 分页查询
    * @Date 16:41 2024/7/13
    * @Param [manageDto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/frpc.manage.query.info")
    public CommonResult<Object> queryPageList(@RequestBody FrpcManageDto manageDto) {
        return service.queryPageList(manageDto);
    }

    /**
    * @Author GroundDemo
    * @Description 查询当前frpc所有运行的接口映射实例状态
    * @Date 20:28 2024/7/13
    * @Param []
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/frpc.manage.frpc.status.info")
    public CommonResult<Object> queryFrpcInstanceStatus(@RequestBody FrpcManageDto manageDto) {
        return service.queryFrpcInstanceStatus(manageDto);
    }
}
